<template>
    <view style="padding: 30rpx;">
        <view class="title"><h4>{{ info.title }}</h4></view>
        <view style="text-align: center;font-size: 28rpx" class="title">{{ info.sendTime }}</view>
        <view class="con">{{ info.content }}</view>

    </view>
</template>

<script>
    import { messageDetail,noticeStatus } from '@/api/my.js';
    export default {
        data() {
            return {
                info:{},
                noticeIds:{noticeIds:[]},
                params:{
                    noticeId:''
                },

            }
        },
        onLoad: function(option) {
            let _this=this;
            _this.params.noticeId=option.noticeId;

            this.getDetail();
        },

        methods:{
            goto(url) {
                uni.navigateTo({
                    url:url
                })
            },
            getDetail(){
                uni.showLoading({
                    title:'加载中'
                });
                console.log(this.params);
                messageDetail(this.params).then(res => {
                    this.info=res.data;
                    this.noticeIds.noticeIds.push(res.data.id);
                    this.updateStatus(this.noticeIds);
                    console.log(this.noticeIds);
                    uni.hideLoading();
                }).catch(res => {
                    uni.hideLoading();
                });

            },
            updateStatus(val){
                noticeStatus(val).then(res => {
                    console.log(this.noticeIds);
                    uni.hideLoading();
                }).catch(res => {
                    uni.hideLoading()
                });
            }
        }
    }
</script>

<style scoped>
    page{
        background-color: #FFFFFF;
    }
    .title{
        text-align: center;
        margin-bottom: 30rpx;
    }
    .con{
        line-height: 42rpx;
        text-align: justify;
        text-align-last: left;
        text-indent: 40rpx;
    }
</style>
